package com.zhanghe.study.hdfs;

import org.apache.hadoop.conf.Configuration;
import org.apache.hadoop.fs.FileSystem;
import org.apache.hadoop.fs.Path;

import java.io.IOException;

/**
 * 测试hdfs客户端
 * @author zh
 * @date 2021/3/26 18:22
 */
public class HdfsClient {
    public static void main(String[] args) throws IOException {
        Configuration conf = new Configuration();
        conf.set("fs.defaultFS","hdfs://localhost:9000");
        // 获取hdfs客户端对象
        FileSystem fs = FileSystem.get(conf);
        // 创建目录
        fs.mkdirs(new Path("/client/test"));
        fs.close();

    }
}
